library(dplyr)
library(tidyr)
library(reshape2)

#Importation confirmes cases for province level

cases_data <- read.table("Data/new_cases_country_provinces_level_clean.csv",sep=",",header=T)

cases_data <- cases_data[,-c(2,3,4)]

#Transformation dataset

var_measures = colnames(cases_data)[2:ncol(cases_data)]

data_vertical <- melt(cases_data,
                      id.vars = "Province_State",
                      measure.vars = var_measures)

data_vertical <- data_vertical %>% 
  group_by(Province_State,variable)

data_vertical <- spread(data_vertical,Province_State,value)

date <- seq.Date(as.Date("2020/01/22"),as.Date("2020/02/26"),1)

data_vertical <- data.frame(date,data_vertical)

data_vertical <- data_vertical[,-2]

#Dataset for country level

country_level_df <- data_vertical[,c("date","China","Iran","Italy","Japan","Singapore","South.Korea")]

#Dataset for province level

province_level_df <- data_vertical[,-c(4,19,20,21,34,35)]

####################################

#Dataset for city level
data_city <- read.table("Data/cumulative_cases_city.csv", sep=",",header=T)
